// pages/register/register.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    disabled:true,
    btnstate:"default",
    switchChecked:false,
    date:"1990-01-01"
  },

  //输入框失效
  accountBlur:function(e){
    var content=e.detail.value;
    if(content!=""){
      this.setData({disabled:false,btnstate:"primary"});
    }else{
      this.setData({disabled:true,btnstate:"default"});
    }
  },

  //日期选择器更改
  bindDateChange:function(e){
    this.setData({
      date:e.detail.value
    })
  },

  //表单提交
  formSubmit:function(e){
    console.log(e);
    var user=new Object();
    user.account=e.detail.value.loginname;
    user.password=e.detail.value.password;
    user.code=e.detail.value.code;
    user.mobile=e.detail.value.mobile;
    user.switch=e.detail.value.switch;
    user.picker=e.detail.value.picker;
    wx.setStorageSync('user', user);
    wx.showToast({
      title: '基本信息填写成功',
      icon:"success",
      duration:1000,
      success:function(){
        wx.switchTab({
          url: '/pages/homepage/homepage',
        })
      }
    });
  },

  //重置
  formReset:function(e){
    console.log(e);
  }
})